#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include "Question.h"

using namespace std;

class StudentTest
{
private:
	string date;
	vector<Question> v;
public:

	StudentTest(void)
	{
		date = "";
	}

	StudentTest(string date) : date(date)
	{

	}

	void Add(Question a)
	{
		v.push_back(a);
	}

	string List()
	{

		ostringstream oss;


		for(int i = 0; i < v.size(); i++)
		{
			oss << v[i] << endl;
		}

		return oss.str();
	}

	void Write2File()
	{
		ofstream ofile;

		ofile.open("test.txt");

		if (ofile.good())
		{
			for (int i = 0; i < v.size(); i++)
			{
				ofile << v[i] << endl;
			}
		}
		ofile.close();
	}


	void ReadFromFile()
	{
		ifstream ifile;
		string text;
		ifile.open("test.txt");

		if (ifile.is_open())
		{
			while (getline(ifile, text))
			{
				cout << text << endl;
			}
			ifile.close();
		}
		else
			cout << "Cant open the file" << endl;
	}

	~StudentTest()
	{
	}

	string GetDate() { return date; }
	void SetDate(string date) { this->date = date; }
};

